﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using DotSpatial.Data;
//using DotSpatial.Projections;
using DotSpatial.Map;
using DotSpatial.Geometries;

using HuanGis;



namespace Map6Exe
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void addlayerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
        }



        FLayerManager m_M;

        private void Form1_Load(object sender, EventArgs e)
        {
            m_M = new FLayerManager(map1 );

            FELineLayer line = new FELineLayer("line");

            m_M.AddLayer(line);

            map1.ZoomToMaxExtent();
           
        }

        protected void CreateAndSaveLayer()
        {

            FeatureSet fs = new FeatureSet(FeatureTypes.Line);
            fs.DataTable.Columns.Add("elevation");


            Coordinate center = new Coordinate(0, 0);
            // random radius from 10 to 100
            double radius = 100;


            Coordinate[] coords = new Coordinate[36];

            for (int j = 35; j >= 0; j--)
            {
                // A coordinate is the simple X and Y location
                coords[j] = new Coordinate(center.X + radius * Math.Cos(j * Math.PI / 18), center.Y + radius * Math.Sin(j * Math.PI / 18));
            }



            Polygon pg = new Polygon(coords);



            IFeature currentFuture = fs.AddFeature(pg);

            currentFuture.DataRow["elevation"] = 100;


            IMapFeatureLayer ifl = map1.Layers.Add(fs);

            

            fs.SaveAs(@"c:\test\hello.shp", true);
 

        }


        private void map1_MouseUp(object sender, MouseEventArgs e)
        {


        }


    }
}
